import { UploadFile } from 'antd';
import { FC } from 'react';
import { ImageUpload } from '@ycx/ui';
import { useTheme } from '@/store/settingsStore.ts';
import { useOss } from '@/hooks';

export type UploadImageProps = {
  value?: UploadFile[];
  onChange?: (fileList: UploadFile[]) => void;
  maxCount?: number;
};

const UploadImage: FC<UploadImageProps> = ({ value, onChange, maxCount }) => {
  const theme = useTheme();
  const uploadProps = useOss({ value, onChange });

  return <ImageUpload {...uploadProps} theme={theme} accept="image/*" maxCount={maxCount} />;
};

export default UploadImage;
